home *** CD-ROM | disk | FTP | other *** search
- Path: news.clark.net!not-for-mail
- From: gusty@clark.net (Harlan Messinger)
- Newsgroups: comp.lang.c++
- Subject: Re: Leap year
- Date: 4 Mar 1996 13:48:26 GMT
- Organization: Clark Internet Services, Inc., Ellicott City, MD USA
- Message-ID: <4hesba$ph@clarknet.clark.net>
- References: <3135A7F2.2120@hiwaay.net> <4hbiln$899@sam.inforamp.net>
- NNTP-Posting-Host: explorer.clark.net
- Mime-Version: 1.0
- Content-Type: TEXT/PLAIN; charset=ISO-8859-1
- Content-Transfer-Encoding: 8bit
- X-Newsreader: TIN [UNIX 1.3 950726BETA PL0]
-
- Randy Charles Morin (rmorin@inforamp.net) wrote:
- : In article <3135A7F2.2120@hiwaay.net>, Lance Perry <lperry@hiwaay.net> wrote:
- : >Can someone be kind enough to post the formula for Leap Year
- : >or point me to the place where this can be found?
- : >
- : >lperry@hiwaay.net
- :
- : bool IsLeapYear(int x)
- : {
- : return ((x&4) && ((!(x&100)) || (x&1000)));
- : }
- :
- : I hope I got everything right.
- :
- : Agrivar
-
- Sorry, you didn't. (x&4) does not tell you whether x is divisible by 4.
- (x&4) returns TRUE, for example, for 5, 6 and 7, none of which is
- divisible by 4. And so on for 100 and 1000. And anyway, the third magic
- number is 400, not 1000.
-
-